app.controller('index.ctrl',['$scope','goodsList','$stateParams',function($scope,goodsList,$stateParams){
    goodsList.goodsList()
        .then(function(res){
            $scope.List=res.data;

        });
    $scope.type=$stateParams.type;

}]);


app.controller('users.ctrl',['$scope',function($scope){


}]);

app.controller('cart.ctrl',['$rootScope','$scope','orderList','goodsList','$stateParams',function($rootScope,$scope,orderList,goodsList,$stateParams){
    orderList.getCart().then(function(res){
        console.log(res.data);
    });


}]);
app.controller('detail.ctrl',['$rootScope','$scope','goodsList','$stateParams','$filter',function ($rootScope,$scope,goodsList,$stateParams,$filter) {
    goodsList.goodsList()
        .then(function(res){
            var results=[];
            $rootScope.List=res.data;
            return angular.forEach($rootScope.List,function(val,key){
                if($rootScope.$id==val.id){
                    results.push(val);
                    return results;
                }

            });
            $rootScope.Cartinfo=results;
            console.log($rootScope.Cartinfo)

        });
    $scope.title=$stateParams.title;



}]);
app.controller('settlement.ctrl',['$scope',function($scope){

}]);
app.controller('main.ctrl',['$scope',function ($scope) {
    $scope.activeIndex='index';
    $scope.change=function (activeIndex) {
        $scope.activeIndex=activeIndex;
    }
}]);
